<?session_start();?>
<html>
	<head>
	<script type="text/javascript" src="jquery.js"></script>
	<script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"></script>
	<link type="text/css" href="css/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />	
	<link type="text/css" href="css/date.css" rel="stylesheet" />	
	<script type="text/javascript">
	var details;
	unit="B7";
	function viewRequestsList(){
		$("#requestsList").html("<img src='gifs/indicator.gif' />");
		$("#requestsList").load('controllers/ViewRequestController.php?mode=1',function(data) {
		  details=data;
		  displayRequestsList();
		});
	}
	function displayRequestsList(){
		$("#requestsList").html(details);
	}
	
	function viewRequest(id1){
	$("#request").html("<img src='gifs/indicator.gif' />");
		$.post('controllers/ViewRequestController.php',{ 
		id:id1
		}, function(data) {
			$("#request").html(data);
		});
	}
	function deleteRequest(){
		var i=0;
		var boxes="";
		while($("#box"+i).val()!=undefined){
			if($("#box"+i).is(':checked')){
				boxes += $("#box"+i).val();
				boxes += ",";
			}
			i++;
		}
		$("#requestsList").html("<img src='gifs/indicator.gif' />");
		$("#request").html("");
		$.post('controllers/DeleteRequestController.php',{
		ids:boxes
		}, function(data) {
			$("#requestsList").html("");
			$("#requestsList").load('controllers/ViewRequestController.php?mode=1',function(data) {
		  details=data;
		  displayRequestsList();
		});
			$("#request").html(data);
		});
	}
	</script>
	</head>
	<body onload="viewRequestsList()">
		<h2>Requests</h2>
		<div id="requestsList">
		</div>
		<div id="request">
		</div>
	</body>
</html>